import { Navigate, createBrowserRouter } from 'react-router-dom'
import Welcome from '@/views/welcome'
import Login from '@/views/login'
import Page404 from '@/views/Page404'
import Page403 from '@/views/Page403'
import Test from '@/views/Test'
import Layout from '@/layout'
import Dashboard from '@/views/dashboard'
import User from '@/views/system/user'
import Dept from '@/views/system/dept'

const router = createBrowserRouter([
  {
    path: '/',
    element: <Navigate to='/welcome' />
  },
  {
    element: <Layout />,
    children: [
      {
        path: '/welcome',
        element: <Welcome />
      },
      {
        path: 'dashboard',
        element: <Dashboard />
      },
      {
        path: 'user',
        element: <User />
      },
      {
        path: 'dept',
        element: <Dept />
      }
    ]
  },
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/test',
    element: <Test />
  },
  {
    path: '*',
    element: <Navigate to='/404' />
  },
  {
    path: '/404',
    element: <Page404 />
  },
  {
    path: '/403',
    element: <Page403 />
  }
])

export default router
